//
//  ZYPurchaseSaleman+IAP.h
//  Pods
//
//  Created by wu on 2020/9/3.
//

#import "ZYPurchaseSaleman.h"

/**
 
 订单校验接口错误码
 0 成功
 2 处理失败
 10002 无访问权限
 10004 参数错误
 20024 API返回收据错误
 20025没有任何交易数据
 20026 订单不存在
 20027 订单平台不匹配
 20028 订单商品不存在
 20029 订单配置包名与收据包名不相同
 20030 为用户发放权益失败
 20031 保存交易数据失败
 20035 读取数据库失败
 */


NS_ASSUME_NONNULL_BEGIN

@interface ZYPurchaseSaleman (IAP) <SKProductsRequestDelegate, SKPaymentTransactionObserver, SKRequestDelegate>

- (BOOL)startIAPPayment:(nonnull NSDictionary *)productDict;

- (BOOL)startIAPPayment:(nonnull NSDictionary *)productDict
               complete:(nullable void (^)(BOOL success, id info))complete;

// 该订单是否未校验收据
- (BOOL)shouldReVerifyReceiptOrder;
// 再次校验收据
- (BOOL)reVerifyReceiptComplete:(void(^)(BOOL success, id info))complete;

+ (NSString *)needReVerifyOrderId;

/// 静默提交所有未成功提交的收据至后台
+ (void)uploadUnVerifyReceiptIfNeededInSilence:(nullable dispatch_block_t)complete;
- (void)uploadUnVerifyReceiptIfNeededInSilence:(nullable dispatch_block_t)complete;


/// 查询商品价格
/// @param productsInfo 商品信息
/// @param complete 回调
+ (void)queryPrice:(nonnull NSArray *)productsArray complete:(nullable void (^)(BOOL success, id info))complete;

/// 查询商品价格
/// @param productsInfo 商品信息
/// @param complete 回调
/// @param invalidProductIdentifiers 获取价格失败的设备
+ (void)queryPrice:(nonnull NSArray *)productsArray complete:(nullable void (^)(BOOL success, id info))complete invalidProductIdentifiers:(nullable void (^)(id invalidArray))invalidProductIdentifiers;

@end

NS_ASSUME_NONNULL_END
